//****************************************************
// Porman Project 2
// Filename: CStateObject.h
// Date: 2009/02/17
// Author: KengYu Lin
// Modify:
//****************************************************
#ifndef _CSTATEOBJECT_H
#define _CSTATEOBJECT_H
#include "CGLDef.h"

namespace Porman
{

namespace GL
{

class PGL_API CAlphaStateObject
{
public:
    CAlphaStateObject( void ) { reset(); }
    CAlphaStateObject( const CAlphaStateObject& l );
    virtual ~CAlphaStateObject( void ) {}
    
    CAlphaStateObject& operator=( const CAlphaStateObject& l );
    bool operator==( const CAlphaStateObject& l );
    bool operator!=( const CAlphaStateObject& l );
    void reset( void );

    bool m_bEnable;
    float m_fAlphaRef;
    ECmpFunc m_eCmpFunc;
};

class PGL_API CBlendStateObject
{
public:
    CBlendStateObject( void ) { reset(); }
    CBlendStateObject( const CBlendStateObject& l );
    virtual ~CBlendStateObject( void ) {}
    
    CBlendStateObject& operator=( const CBlendStateObject& l );
    bool operator==( const CBlendStateObject& l );
    bool operator!=( const CBlendStateObject& l );
    void reset( void );

    bool m_bEnable;
    EBlendOp       m_eBlendOp;
    EBlendFactor   m_eSrcBlendFactor;
    EBlendFactor   m_eDstBlendFactor;
};

class PGL_API CDepthStateObject
{
public:
    CDepthStateObject( void ) { reset(); }
    CDepthStateObject( const CDepthStateObject& l );
    virtual ~CDepthStateObject( void ) {}

    CDepthStateObject& operator=( const CDepthStateObject& l );
    bool operator==( const CDepthStateObject& l );
    bool operator!=( const CDepthStateObject& l );
    void reset( void );

    bool m_bEnable;
    ECmpFunc m_eCmpFunc;
};

class PGL_API CStencilStateObject
{
public:
    CStencilStateObject( void ) { reset(); }
    CStencilStateObject( const CStencilStateObject& l );
    virtual ~CStencilStateObject( void ) {}

    CStencilStateObject& operator=( const CStencilStateObject& l );
    bool operator==( const CStencilStateObject& l );
    bool operator!=( const CStencilStateObject& l );
    void reset( void );

    bool             m_bEnable;
    int              m_iStencilRef;
    unsigned int     m_uiStencilMask;

    EStencilOp       m_eStencilFail;
    EStencilOp       m_eDepthFail;
    EStencilOp       m_eDepthStencilAllPass;
    EFaceType        m_eFaceType;
    ECmpFunc         m_eCmpFunc;
};

class PGL_API CScissorStateObject
{
public:
    CScissorStateObject( void ) { reset(); }
    CScissorStateObject( const CScissorStateObject& l );
    virtual ~CScissorStateObject( void ) {}

    CScissorStateObject& operator=( const CScissorStateObject& l );
    bool operator==( const CScissorStateObject& l );
    bool operator!=( const CScissorStateObject& l );
    void reset( void );

    bool m_bEnable;
    int  m_iX, m_iY;
    int m_iWidth, m_iHeight;
};

class PGL_API CCullFaceStateObject
{
public: 
    CCullFaceStateObject( void ) { reset(); }
    CCullFaceStateObject( const CCullFaceStateObject& l );
    virtual ~CCullFaceStateObject( void ) {}

    CCullFaceStateObject& operator=( const CCullFaceStateObject& l );
    bool operator==( const CCullFaceStateObject& l );
    bool operator!=( const CCullFaceStateObject& l );
    void reset( void );

    bool m_bEnable;
    EFaceType m_eFaceType;
    ECullFace m_eCullFace;
};

class PGL_API CPolygonOffsetStateObject
{
public:
    CPolygonOffsetStateObject( void ) { reset(); }
    CPolygonOffsetStateObject( const CPolygonOffsetStateObject& l );
    virtual ~CPolygonOffsetStateObject( void ) {}

    CPolygonOffsetStateObject& operator=( const CPolygonOffsetStateObject& l );
    bool operator==( const CPolygonOffsetStateObject& l );
    bool operator!=( const CPolygonOffsetStateObject& l );
    void reset( void );

    bool m_bEnable;
    float m_fFactor;
    float m_fUnits;
};

class PGL_API CPolygonModeStateObject
{
public:
    CPolygonModeStateObject( void ) { reset(); }
    CPolygonModeStateObject( const CPolygonModeStateObject& l );
    virtual ~CPolygonModeStateObject( void ) {}

    CPolygonModeStateObject& operator=( const CPolygonModeStateObject& l );
    bool operator==( const CPolygonModeStateObject& l );
    bool operator!=( const CPolygonModeStateObject& l );
    void reset( void );

    EFaceType    m_eFaceType;
    EPolygonMode m_eMode;
};

}//End namespace GL

}//End namespace Porman

#endif